package com.nsoft.server.service.main;

import java.sql.*;

class Sample {
	public static void main(String[] Args) {

		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
		}

		catch (Exception E) {
			System.err.println("Unable to load driver.");
			E.printStackTrace();
		}

		try {
			java.sql.Connection conn;
	 
			conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/nsoft","root","bycycle");
			
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery("SELECT * from userdetails");
			stmt.executeUpdate("INSERT userdetails VALUES("+13+","+"'Aman'"+
					","+"'Aman'"+
					")");
	        
        
			while (rs.next()) {
				System.out.println(rs.getString(1));
			}

			rs.close();
			stmt.close();
			conn.close();
		}

		catch (SQLException E) {
			System.out.println("SQLException: " + E.getMessage());
			System.out.println("SQLState:     " + E.getSQLState());
			System.out.println("VendorError:  " + E.getErrorCode());
		}
	}	
}

